<?php


//git reset HEAD b46927f git merge --abort
//echo shell_exec("/usr/local/git/bin/git add /data/wwwroot/property_81/.");
//echo shell_exec("/usr/local/git/bin/git commit -m 'property'");
//echo shell_exec("/usr/local/git/bin/git status ");

//exit;
//本地路径
$local = '/data/wwwroot/property_81';
//仓库地址
$remote = 'https://gitee.com/orange_loves_to_laugh/leegame.git';

//密码
$password = 'leegame.git';

//获取请求参数
$request = file_get_contents('php://input');
if (empty($request)) {
    die('request is empty');
}

//验证密码是否正确
$data = json_decode($request, true);
if ($data['password'] != $password) {
    die('password is error');
}

echo shell_exec("cd {$local} && /usr/bin/git pull {$remote} 2>&1");

//die('done ' . date('Y-m-d H:i:s', time()));